
package com.cwt_taxi_xa.record;

import com.cwt_taxi_xa.model.RecorderInfo;
import com.cwt_taxi_xa.util.AppLog;
import com.cwt_taxi_xa.util.ExceptionUtil;

import java.util.ArrayList;
import java.util.TimerTask;

/**
 * @author zr
 * 录音timer 每一小时执行一次
 */
public class RecordTimer extends TimerTask {

	private static final String TAG = "RecordTimer";

	/**
	 * 录音原因
	 * 0:正常录音 1:乘客不满意投诉 2：报警录音
	 */
	public static int recordReason = 0;
	/**
	 * 收集整个营运订单的录音id
	 */
	public static ArrayList<String> mediaIdList = null;

	@Override
	public void run() {

		try {
			if(recordReason == 0){
				AppLog.i(TAG, "录音：正常录音");
			}else if(recordReason == 1){
				AppLog.i(TAG, "录音：乘客不满意投诉");
			}else if(recordReason == 2){
				AppLog.i(TAG, "录音：报警录音");
			}
			RecorderInfo recordingInfo = new RecorderInfo(recordReason);
			if(mediaIdList != null){
				mediaIdList.add(recordingInfo.getMediaId());
			}
			SystemRecord.doRecord(recordingInfo);

		} catch (Exception e) {
			e.printStackTrace();
			AppLog.e(ExceptionUtil.getInfo(e), e);
		}

	}
}
